package com.bwie.controller;

import com.bwie.pojo.GoodsPoEs;
import com.bwie.service.EsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class EsController {
    @Autowired
    private EsService esService;
    /**
     * 创建索引
     */
    @PutMapping("/createIndex")
    public void createIndex(){
        esService.createIndex();
    }
    /**
     * 添加
     */
    @PostMapping("/add")
    public void add(@RequestBody GoodsPoEs goodsPoEs){
        // 调用esService的add方法，将goodsPoEs作为参数传入
        esService.add(goodsPoEs);
    }
    /**
     * 单删
     */
    @DeleteMapping("/delete")
    public void delete(Integer goodsId){
        esService.delete(goodsId);
    }
    /**
     * 修改
     */
    @PutMapping("/update")
    public void update(@RequestBody GoodsPoEs goodsPoEs){
        esService.update(goodsPoEs);
    }
    /**
     * 最大值查询
     */
    @GetMapping("/max")
    public void max(){
        esService.max();
    }
    /**
     * 条件查询
     */
    @PostMapping("search")
    public void search(@RequestBody GoodsPoEs goodsPoEs){
        esService.search(goodsPoEs);
    }
    /**
     * 分组
     */
    @GetMapping("/group")
    public void group(){
        esService.group();
    }
}
